﻿using WpfModelEditor.Core.Plugins;
using HelixToolkit.Wpf.SharpDX.Model;
using HelixToolkit.Wpf.SharpDX.Model.Scene;
using WpfModelEditor.Core.Controls;

namespace ViewPlugin
{
    /// <summary>
    /// MaterialPanel.xaml 的交互逻辑
    /// </summary>
    public partial class MaterialPanel
    {
        private IHost Host { get; set; }
        public MaterialPanel()
        {
            InitializeComponent();
        }
        public MaterialPanel(IHost host)
        {
            InitializeComponent();
            Host = host;
            pg.EditorCreator = new PropertyEditorCreator();
        }
        public void Update()
        {
            var node = Host.SelectedObject as MeshNode;
            if (node == null)
            {
                pg.SelectedObject = null;
            }
            else
            {
                var mat = node.Material;
                pg.SelectedObject = mat;
            }
        }
    }
}
